package com.sdu.douban_comment.entity;

public class Result<T> {

    private int code;
    private String message;
    private T content;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getContent() {
        return content;
    }

    public void setContent(T content) {
        this.content = content;
    }

    public Result(int code, String message, T content) {
        this.code = code;
        this.message = message;
        this.content = content;
    }

    public static <T> Result<T> ok(String message, T content){
        return new Result<>(200,message,content);

    }

    public static Result ok(String message){
        return Result.ok(message,null);
    }

    public static Result error(String message){
        return new Result<>(500,message,null);
    }


}
